package com.clkj.sunhelp.adapter.list;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.clkj.sunhelp.R;
import com.clkj.sunhelp.bean.SeekHelpHisListItem;

import java.util.List;

/**
 * Created by Administrator on 2017/3/27.
 */

public class ListAdapterForSeekHelpHis extends BaseAdapter {


    List<SeekHelpHisListItem> mSeekHelpHisList;
    Context mContext;
    LayoutInflater mLayoutInflater;

    public ListAdapterForSeekHelpHis(Context context, List<SeekHelpHisListItem> mSeekHelpHisList) {
        mContext = context;
        this.mSeekHelpHisList = mSeekHelpHisList;
        mLayoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mSeekHelpHisList.size();
    }

    @Override
    public Object getItem(int i) {
        return mSeekHelpHisList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder viewHolder = null;
        if (view == null)
        {
            view = mLayoutInflater.inflate(R.layout.list_item_seek_help_his,null);
            viewHolder = new ViewHolder();
            viewHolder.tvHomeOwnerName = (TextView) view.findViewById(R.id.tv_home_owner_name);
            viewHolder.tvIdcardNo = (TextView) view.findViewById(R.id.tv_idcard_no);
            viewHolder.tvApplyPro = (TextView) view.findViewById(R.id.tv_apply_pro);
            viewHolder.tvApplyTime = (TextView) view.findViewById(R.id.tv_apply_time);
            viewHolder.tvDealState = (TextView) view.findViewById(R.id.tv_deal_state);

            view.setTag(viewHolder);

        }else {
            viewHolder = (ViewHolder) view.getTag();
        }

        viewHolder.tvHomeOwnerName.setText(mSeekHelpHisList.get(i).getHuZhuName());
        viewHolder.tvIdcardNo.setText(mSeekHelpHisList.get(i).getIdCardNo());
        viewHolder.tvApplyPro.setText(mSeekHelpHisList.get(i).getApplyProjName());
        viewHolder.tvApplyTime .setText(mSeekHelpHisList.get(i).getApplyTime());
        viewHolder.tvDealState .setText(mSeekHelpHisList.get(i).getDealState());

        return view;
    }


    static class ViewHolder{
        private TextView tvHomeOwnerName;
        private TextView tvIdcardNo;
        private TextView tvApplyPro;
        private TextView tvApplyTime;
        private TextView tvDealState;





    }


}
